package teacher

import (
	"anban/controllers"
	"anban/models"
	"anban/service"
	"html/template"
)

type StudentController struct {
	controllers.BaseController
}

func (c *StudentController) Detail() {
	id := c.Ctx.Input.Param(":id")

	p := map[string]interface{}{}
	p["id"] = id
	p["relation"] = true
	student := service.GetStudentInfo(p)
	c.Data["studentInfo"] = student

	var userList []*models.User
	if len(student.FamilySn) > 0 {
		p = map[string]interface{}{}
		p["relation"] = true
		p["familySn"] = student.FamilySn
		p["status"] = 1
		_, userList = service.GetUserList(p)
	}
	c.Data["userList"] = userList

	c.Data["title"] = "班级成员信息"
	c.Data["xsrfdata"] = template.HTML(c.XSRFFormHTML())
	c.TplName = "teacher/student-detail.html"
}